//
//  CreateManager.m
//  CodeFactory
//
//  Created by daibaisheng on 2019/4/29.
//  Copyright © 2019 daibaisheng. All rights reserved.
//

#import "CreateManager.h"
#import "CreateFileforOBJC.h"
#import "NSFileManager+Tools.h"

#define  FILE_NAME @"MVCCoderfiles"
#define  PLIST_NAME @"Object"
#define  TYPE @"plist"

@implementation CreateManager


+(id)sharedInstance{
    static dispatch_once_t onceToken;
    static CreateManager * manager;
    dispatch_once(&onceToken,^{
        manager = [[CreateManager alloc] init];
    });
    return manager;
}

-(void)CreateCoder:(NSString *)fileName;
{
  NSDictionary *dic = [NSFileManager accessModelPlist:PLIST_NAME type:TYPE];
//    NSString *path = [NSFileManager getDesktopFilePath:FILE_NAME];
    [NSFileManager createDirectory:[[self class] returnPath]];

    CreateFileforOBJC *creator =[[CreateFileforOBJC alloc]initCreateFileforOBJC:[[self class] returnPath] plist:dic];
    [creator creatNeedFile:fileName];

}


+(NSString *)returnPath;
{
    NSString *path = [NSFileManager getDesktopFilePath:FILE_NAME];
    return path;
    
    
}




-(void)removeFiles;
{
    
    NSString *path = [NSFileManager getDesktopFilePath:FILE_NAME];
    [NSFileManager removeDirectory:path];

}




@end
